package com.smart.home.system;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class StringUtils {
	//将String中的逗号分割开来，返回一个list
	
	public static List<String> getStrings(String str){
		if(org.apache.commons.lang3.StringUtils.isBlank(str)){
			return null;
		}
		String [] temp = str.split(",");
		List<String> strings = new ArrayList<String>();
		for(String str1:temp){
			strings.add(str1);
		}
		temp = null;
		strings = new ArrayList<String>(new HashSet<String>(strings));
		return strings;
	}
	
	public static String getLists(List<String> list){
		StringBuilder str=new StringBuilder();
        boolean flag=false;
        for (String string : list) {
            if (flag) {
                str.append(",");
            }else {
                flag=true;
            }
            str.append(string);
        }
		return str.toString();
	}

}
